//
//  FLMManageOrderHeaderCell.m
//  FLMSuperS
//
//  Created by xiaoyang on 16/9/16.
//  Copyright © 2016年 FaLaoMiaoNetworkTechnologyCo. All rights reserved.
//

#import "FLMManageOrderHeaderCell.h"

@interface FLMManageOrderHeaderCell()
@property (nonatomic, strong)  UIImageView *bgImageView, *iconImageView;
@property (nonatomic, strong)  UILabel *titleLb;
@end


@implementation FLMManageOrderHeaderCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self layoutUI];
    }
    
    return self;
}

- (void)layoutUI
{
    if (!_bgImageView) {
        _bgImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:_bgImageView];
        [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(@0);
        }];
    }
    
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:_iconImageView];
        [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@15);
            make.right.equalTo(@-15);
            make.height.equalTo(_iconImageView.mas_width);
        }];
    }

    if (!_titleLb) {
        _titleLb = [[UILabel alloc]init];
        _titleLb.font = font14;
        [self.contentView addSubview:_titleLb];
        [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.bottom.equalTo(@-15);
        }];
    }
    
}

- (void)configCellWithTitle:(NSString *)title iconImage:(NSString *)image isSelceted:(BOOL) isSelect
{
    UIImage *selectImage = [UIImage imageNamed:[NSString stringWithFormat:@"sel_%@",image]];
    UIImage *norImage = [UIImage imageNamed:image];
    _bgImageView.image = isSelect?selectImage:norImage;
    _titleLb.textColor = isSelect?orange:white;
    _titleLb.text = title;
    
}

@end
